<!doctype html>
<html lang="zh-CN" th:replace="admin-layout :: layout(~{::title}, ~{}, ~{::script}, ~{::body}, 'menu-list')"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <title th:text="${data}?'修改菜单':_">添加菜单</title>
    <script>
        $("#submitBtn").click(function(){
            var name=$("input[name='name']").val();
            if(name==''){
                msgAlert("请输入名称")
                return;
            }
            ajaxJson("/admin/menu/ajax/save",$("#form").serialize(),function(res){
                if(res.status){
                    location.href="/admin/menu/list3";
                }
            })
        })
    </script>
</head>
<body>
<ol class="breadcrumb">
    <li><a th:href="@{/admin/menu/list}">菜单列表</a></li>
    <li class="active"th:text="${data}?'修改菜单':_">添加菜单</li>
</ol>
<form class="form-horizontal" id="form">
    <input type="hidden" name="id" th:if="${data}" th:value="${data.id}">
    <div class="form-group">
        <label class="col-sm-2 col-md-2 col-lg-3 control-label"><span class="text-danger">*&nbsp;</span>名称</label>
        <div class="col-sm-8 col-md-8 col-lg-6">
            <input type="text" class="form-control" placeholder="请输入" id="name" name="name" th:value="${data}?${data.name}">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 col-md-2 col-lg-3 control-label"><span class="text-danger">*&nbsp;</span>链接</label>
        <div class="col-sm-8 col-md-8 col-lg-6">
            <input type="text" class="form-control" placeholder="请输入" id="link" name="link" th:value="${data}?${data.link}">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 col-md-2 col-lg-3 control-label"><span class="text-danger">*&nbsp;</span>标志</label>
        <div class="col-sm-8 col-md-8 col-lg-6">
            <input type="text" class="form-control" placeholder="请输入" id="mark" name="mark" th:value="${data}?${data.mark}">
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-md-offset-2 col-lg-offset-3 col-sm-8 col-md-8 col-lg-6">
            <button type="button" class="btn btn-primary" id="submitBtn">提交</button>
            <button type="button" class="btn btn-warning backBtn">返回</button>
        </div>
    </div>
</form>
</body>
</html>